	
	var exhibit;	
	function loadJSON(data){

    var facets = [ "<div ex:role='facet' ex:expression='.type'></div>" ];
	var property_count = {};
	for (var i=0; i < data.items.length; i++) {
		var item = data.items[i];
		for (var p in item) {
			if(!property_count[p]) property_count[p] = 1;
			else property_count[p]++;
		}
	};
    for (var p in data.properties) {
		if(property_count[p] > 1) 
		{
	        facets.push("<div ex:role='facet' ex:expression='." + p + "'></div>");
		}
    }
    document.getElementById("facets").innerHTML = facets.join("");

 	database = Exhibit.Database.create();
    database.loadData(data);
    window.exhibit = Exhibit.create();
    window.exhibit.configureFromDOM();
}
